<%template _header%>
<%namespace YouHP.Model%>
<div id="searchpatient">

    <script type="text/javascript">
		var curtab = "location";
	    var succ =true;
		function swapTab(tab)
		{
		     succ =true ;
		     init();
		     function init()
		   {
		   
            var obj1= $("beginyear");
            var obj2= $("endyear");
//            var obj3= $("province");
//            var obj4= $("city");
            var obj5= $("username");
            var obj6= $("disease");
            var obj7= $("treatmentname");
            var obj8= $("symptomname");
		    
            obj1.options[0].selected =true;
            obj2.options[0].selected =true;
//            obj3.options[0].selected =true;
//            obj4.options[0].selected =true;
            obj5.value =null;
            obj6.options[0].selected =true;
            obj7.options[0].selected =true;
            obj8.options[0].selected =true;

		    }
			 var ctrl = $("ui-" + curtab);
			 ctrl.style.display = 'none';
			 ctrl = $("ui-" + tab);
			 ctrl.style.display = 'block';
			 curtab = tab;
			
		}
		
        function checkform()
        { 
         if (succ) { var f =$("postform"); f.submit();}
        }
                  
                
	    function compare()
		{
		  
	       $("result").innerHTML= "";
		   var age = $("beginyear").value;
		   var age1 = $("endyear").value;
		   
		   if(age !=-1 && age1 !=-1&& age>=age1)
		   {
		  
		   $("result").innerHTML = "<font color='#009900'>你输入的年龄范围不正确！</font>";
		   succ =false;
		   return false;
		   }
		   succ =true;
		   return true;
		
		}
		
	
    </script>

    <div id="search-links">
        <a href="#" id="lnk-location" name="location" onclick="swapTab('location');">地区</a>
        <a href="#" id="lnk-age" name="age" onclick="swapTab('age');">年龄</a> <a href="#"
            id="lnk-age" name="user" onclick="swapTab('user');">用户</a> <a href="#" id="lnk-age"
                name="disease" onclick="swapTab('disease');">疾病</a> <a href="#" id="lnk-age" name="treatment"
                    onclick="swapTab('treament');">治疗</a> <a href="#" id="lnk-age" name="symptom" onclick="swapTab('symptom');">
                        症状</a>
    </div>
    <br />
    <div id="search-ui">
        <form method="post" id="postform">
        <table border="1">
            <tr>
                <td>
                    <div id="ui-location" style="display: block">
                        地区 省份
                        <select name="province" id="province"  onchange="if(this.value !='') setCity(this.options[this.selectedIndex].value)">
                        <option value="">-请选择-</option>     
                        <option value="江苏省">江苏省</option>     
                        <option value="浙江省">浙江省</option> 
                        </select>
                        城市
                        <select name="city" id ="city">
                        <option value ="">-请选择-</option>
                        </select>
                    </div>
                    <div id="ui-age" style="display: none">
                        年龄范围： 
                        <select id="beginyear" name="minage" onchange="compare();">
                            <option value="-1" selected>请选择</option>
                            <option value="10">10</option>
                            <option value="20">20</option>
                        </select>岁 到
                        <select id="endyear" name="maxage" onchange="compare();">
                            <option value="-1" selected>请选择</option>
                            <option value="10">10</option>
                            <option value="20">20</option>
                        </select>岁

                        &nbsp;<span id="result"></span>
                    </div>
                    <div id="ui-user" style="display: none">
                        用户名：
                        <input type="text" id="username" name="username" length="20">
                    </div>
                    <div id="ui-disease" style="display: none">
                        疾病:
                        <select id="disease" name="disease">
                            <option value="" selected>请选择</option>
                            <%csharp%>
                            foreach( DiseaseInfo Info in mDiseaseLst) {
                            <%/csharp%>
                            <option value="{Info.Id}">{Info.Name}</option>
                            <%csharp%>
                            }
                            <%/csharp%>
                        </select>
                    </div>
                    <div id="ui-treament" style="display: none">
                        治疗：
                        <select id="treatmentname" name="treatmentname">
                            <option value="" selected>请选择</option>
                            <%csharp%>
                            foreach( TreatmentInfo Info in mTreatmentLst) {
                            <%/csharp%>
                            <option value="{Info.Id}">{Info.Name}</option>
                            <%csharp%>
                            }
                            <%/csharp%>
                        </select>
                    </div>
                    <div id="ui-symptom" style="display: none">
                        症状：
                        <select id="symptomname" name="symptomname">
                            <option value="" selected>请选择</option>
                            <%csharp%>
                            foreach( SymptomInfo Info in mSymptomLst) {
                            <%/csharp%>
                            <option value="{Info.Id}">{Info.Name}</option>
                            <%csharp%>
                            }
                            <%/csharp%>
                        </select>
                    </div>
                </td>
                <td>
                    <input id="post" type="button" value="搜索" onclick="checkform()" />
                    
                </td>
            </tr>
        </table> 
      
        </form>
        
    </div>
     <a  href ="SearchPatient.aspx" >高级搜索</a>
</div>
<%if ErrorCount==0%>
<br />
<table width="100%">
    <tr>
        <td width="25%">
            <div id="navUser">
                按拼音首字母排序：
                <br />
                <%csharp%>
                foreach(string ch in mPingYin) {
                <%/csharp%>
                <a href="?PinYin={ch}">{ch}</a>
                <%csharp%>
                }
                <%/csharp%>
            </div>
        </td>
        <td align="right">
            <div id="Userpage">
                <div>
                    <a href="{url}&page={1}">第一页</a> <a href="{url}&page={_prevpage}">前一页</a> <a href="#">
                        ...</a>
                    <%csharp%>
                    int pageno = 0; for(int i=0; i < _pageCount; i++) { pageno ++;
                    <%/csharp%>
                    <%if {pageno}==_pageIndex %>
                    <a href="{url}&page={pageno}"><b>{pageno}</b></a>
                    <%else%>
                    <a href="{url}&page={pageno}">{pageno}</a>
                    <%/if%>
                    <%csharp%>
                    }
                    <%/csharp%>
                    <a href="#">...</a> <a href="{url}&page={_nextpage}">后一页</a> <a href="{url}&page={_pageCount}">
                        最后一页</a>
                </div>
                <div>
                    <form method="post" action="">
                    <select id="Select1" name="pagesel">
                        <%csharp%>
                        for(int i=1; i <= _pageCount; i++) {
                        <%/csharp%>
                        <%if i==_pageIndex %>
                        <option value="{i}" selected="selected">{i}</option>
                        <%else%>
                        <option value="{i}">{i}</option>
                        <%/if%>
                        <%csharp%>
                        }
                        <%/csharp%>
                    </select>
                    <input type="submit" value="跳转到" />
                    </form>
                </div>
            </div>
            <br />
            <div id="listpatient">
                <table border="1">
                    <%csharp%>
                    int listpatient_i = 0; foreach(UserInfo info in mUserLst) { listpatient_i ++;
                    <%/csharp%>
                    <tr>
                        <td>
                            <div id="patientindex">
                                <input type="checkbox" name="patient{listpatient_i}" value="{listpatient_i}"></input>
                            </div>
                        </td>
                        <td>
                            <div id="patientonline">
                                <%if {info.IsOnline}==true%>
                                在线
                                <%else%>
                                离开
                                <%/if%>
                            </div>
                        </td>
                        <td>
                            <div id="patientname">
                                <a href="#{info.Id}" onclick="alert('{info.UserName}');">{info.UserName}</a>
                            </div>
                        </td>
                        <td>
                            <div id="patientdisease">
                                <a href="#"></a>
                            </div>
                        </td>
                        <td>
                            <div id="patientupdatecount">
                            更新次数：{info.UpdateTimes}&nbsp;&nbsp;
                        </td>
                        <td>
                            <div id="patientupdatedate">
                                最近更新：{info.LastUpdateDate}
                            </div>
                        </td>
                    </tr>
                    <%csharp%>
                    }
                    <%/csharp%>
                </table>
                <div id="Div1">
                    <a href="{url}&page={1}">第一页</a> <a href="{url}&page={_prevpage}">前一页</a> <a href="#">
                        ...</a>
                    <%csharp%>
                    int pageno2 = 0; for(int i=0; i < _pageCount; i++) { pageno2 ++;
                    <%/csharp%>
                    <%if {pageno2}==_pageIndex %>
                    <a href="{url}&page={pageno2}"><b>{pageno2}</b></a>
                    <%else%>
                    <a href="{url}&page={pageno2}">{pageno2}</a>
                    <%/if%>
                    <%csharp%>
                    }
                    <%/csharp%>
                    <a href="#">...</a> <a href="{url}&page={_nextpage}">后一页</a> <a href="{url}&page={_pageCount}">
                        最后一页</a>
                    <form method="post" action="">
                    <select id="Select2" name="pagesel">
                        <%csharp%>
                        for(int i=1; i <= _pageCount; i++) {
                        <%/csharp%>
                        <%if i==_pageIndex %>
                        <option value="{i}" selected="selected">{i}</option>
                        <%else%>
                        <option value="{i}">{i}</option>
                        <%/if%>
                        <%csharp%>
                        }
                        <%/csharp%>
                    </select>
                    <input type="submit" value="跳转到" />
                    </form>
                </div>
        </td>
    </tr>
</table>
<%else%>
<%template _memerrmsgbox%>
<%/if%>
<%template _footer%>